//接口
interface IFlying {
    void fly();
}
interface IRunning {
    void run();
}
interface ISwimming {
    void swim();
}
class Animal {
    public Animal(String name,int age) {
        this.age = age;
        this.name = name;
    }
    String name;
    int age;
    public void eat() {
        System.out.println(name+"正在吃饭");
    }
}
class Dog extends Animal implements IRunning,ISwimming {

    public Dog(String name,int age) {
        super(name,age);
    }
    @Override
    public void run() {
        System.out.println(name+"正在跑");
    }

    @Override
    public void swim() {
        System.out.println(name+"正在游泳");
    }
    public void eat() {
        System.out.println(name+"正在吃狗粮");
    }
}
class Cat extends Animal implements IRunning {

    public Cat(String name,int age) {
        super(name,age);
    }
    @Override
    public void run() {
        System.out.println(name+"正在跑");
    }
    public void eat() {
        System.out.println(name+"正在吃猫粮");
    }
}
class Bird extends Animal implements IRunning,ISwimming,IFlying {

    public Bird(String name,int age) {
        super(name,age);
    }
    @Override
    public void fly() {
        System.out.println(name+"正在飞");
    }

    @Override
    public void run() {
        System.out.println(name+"正在跑");
    }

    @Override
    public void swim() {
        System.out.println(name+"正在游泳");
    }
    public void eat() {
        System.out.println(name+"正在吃鸟粮");
    }
}
public class Demo {
    public static void run(IRunning iRunning) {
        iRunning.run();
    }
    public static void eat(Animal animal) {
        animal.eat();
    }
    public static void main(String[] args) {
        run(new Dog("旺福",3));
        run(new Cat("PerPer",3));
        run(new Bird("小鸟",3));
        eat(new Dog("旺福",3));
        eat(new Cat("PerPer",3));
        eat(new Bird("小鸟",3));
    }
}
